@extends('layouts.admin.layout')

@section('content')
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">编辑权限</strong> / <small>Edit</small></div>
            </div>

            <hr>
            @include('layouts.admin._flash')
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form am-form-horizontal" action="{{route('auth.permission_update',$permission->id)}}" method="post">
                        {!! csrf_field() !!}
                        {{ method_field('PUT') }}
                        <div class="am-form-group">
                            <label for="doc-select-1" class="am-u-sm-2 am-form-label">所属模块</label>
                            <div class="am-u-sm-10">
                                <select id="doc-select-1" name="pid">
                                    <option value="0">顶级模块</option>
                                    @foreach($top_permissions as $top_permission)
                                        <option value="{{$top_permission->id}}" @if ($permission->pid == $top_permission->id) selected @endif>{{$top_permission->label}}</option>
                                    @endforeach
                                </select>
                            </div>

                            <span class="am-form-caret"></span>
                        </div>

                        <div class="am-form-group">
                            <label for="doc-ipt-1" class="am-u-sm-2 am-form-label">权限名</label>
                            <div class="am-u-sm-10">
                                <input type="text" name="label" id="doc-ipt-1" value="{{$permission->label}}">
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label for="doc-ipt-3" class="am-u-sm-2 am-form-label">权限路由标识</label>
                            <div class="am-u-sm-10">
                                <input type="text" name="name" id="doc-ipt-3" value="{{$permission->name}}">
                            </div>
                        </div>

                        <div class="am-form-group">
                            <div class="am-u-sm-10 am-u-sm-offset-2">
                                <button type="submit" class="am-btn am-btn-primary">提交</button>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </div>
@endsection